package com.qf.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import com.qf.utils.MyBatisUtils;

import java.util.List;

public class UserServiceImpl implements UserService {
    @Override
    public PageInfo<User> findUserPage(Integer pageNo, Integer pageSize) {
        UserMapper userMapper = MyBatisUtils.getMapper(UserMapper.class);

        //设置分页参数， 当前页，每页查询条数， 插件会自动计算从第几条开始查询
        PageHelper.startPage(pageNo,pageSize);

        //查询
        List<User> list = userMapper.findUserByPage();
        //封装分页返回结果
        PageInfo<User> pageInfo = new PageInfo<>(list);

        return pageInfo;
    }
}
